package action.dwzkdj;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.util.Component;
import com.PublicSystem;
import com.util.Util;
import com.syslog.SysLogServices;
import services.dwzkdj.DwzkServices;
/**
 * 单位制卡登记Action
 * @author Administrator
 *
 */
@Controller
@RequestMapping("make.do")
public class DwzkAction {
	DwzkServices ss = new DwzkServices();
	PublicSystem sys = PublicSystem.getInstance();
	SysLogServices log = SysLogServices.getInstance();
	/**
	 * 银行下拉框选项
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getyinhang")
	public void getYinhang(HttpServletRequest request, HttpServletResponse response) throws Exception {
		List data = ss.getYinhang(Component.getQuest("sj", request));
		Component.print(Util.Encode(data), response);
	}
	/**
	 * 性别下拉框选项
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getaac004")
	public void getSelectaac004(HttpServletRequest request, HttpServletResponse response) throws Exception {
		List data = ss.getSelect(Component.getQuest("lx", request));
		Component.print(Util.Encode(data), response);
	}	
	/**
	 * 证件下拉框选项
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getaac058")
	public void getSelectaac058(HttpServletRequest request, HttpServletResponse response) throws Exception {
		List data = ss.getSelect(Component.getQuest("lx", request));
		Component.print(Util.Encode(data), response);
	}	
	/**
	 * 民族下拉框选项
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getaac005")
	public void getSelectaac005(HttpServletRequest request, HttpServletResponse response) throws Exception {
		List data = ss.getSelect(Component.getQuest("lx", request));
		Component.print(Util.Encode(data), response);
	}	
	/**
	 * 查询单位登记信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getunitdata")
	public void getunitdata(HttpServletRequest request, HttpServletResponse response) throws Exception {
		HashMap user = ss.getUnitData(Component.getQuest("id", request));
		String aae011 = Component.getSession("userid", request);
		HashMap obj = new HashMap();
		if(user == null) {
			obj.put("domainid", "SBK");  //分系统号，见sys_log_bm
			obj.put("log_type", "T05");   //日志类别，见sys_log_bm
			obj.put("userid", aae011); //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "单位信息查询，劳动保障证号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "error");  //输出参数
			log.sysLogMap(obj, request);
		} else {
			obj.put("domainid", "SBK");   //分系统号，见sys_log_bm
			obj.put("log_type", "T05");   //日志类别，见sys_log_bm
			obj.put("userid", aae011);    //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "单位信息查询，劳动保障证号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "success");//输出参数
			log.sysLogMap(obj, request);
		}
		Component.print(Util.Encode(user), response);
	}	
	/**
	 * 查询个人制卡登记信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getunitdata2")
	public void getunitdata2(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String aac001 = Component.getQuest("id", request);
		String aaz001 = Component.getQuest("aaz001", request);
		HashMap user = ss.getUnitData2(aac001);
		String aae011 = Component.getSession("userid", request);
		HashMap obj = new HashMap();	
		if(user == null) {
			obj.put("domainid", "SBK");  //分系统号，见sys_log_bm
			obj.put("log_type", "T05");  //日志类别，见sys_log_bm
			obj.put("userid", aae011);   //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "个人信息查询，社会保障卡号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "error");//输出参数
			log.sysLogMap(obj, request);
		} else {
			obj.put("domainid", "SBK");  //分系统号，见sys_log_bm
			obj.put("log_type", "T05");   //日志类别，见sys_log_bm
			obj.put("userid", aae011); //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "个人信息查询，社会保障卡号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "success");//输出参数
			log.sysLogMap(obj, request);
		}
		if(null == user)
		{
			Component.print(Util.Encode(user), response);
			return;
		}
		user.put("aaz001", aaz001);
		String str = ss.selectUnit1(user);
     	String[] res = str.split("&");
     	if(!res[0].equals("0")) { 
     		user.put("msg", res[0]);
     		Component.print(Util.Encode(user), response);
     	} else {
     		user.put("msg", res[0]);
     		Component.print(Util.Encode(user), response);
     	}     			
	}	
	/**
	 * 查询个人制卡登记信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getunitdata3")
	public void getunitdata3(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String aac001 = Component.getQuest("id", request);
		String aaz001 = Component.getQuest("aaz001", request);
		HashMap user = ss.getUnitData2(aac001);
		String aae011 = Component.getSession("userid", request);
		HashMap obj = new HashMap();	
		if(user == null) {
			obj.put("domainid", "SBK");  //分系统号，见sys_log_bm
			obj.put("log_type", "T05");  //日志类别，见sys_log_bm
			obj.put("userid", aae011);   //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "个人信息查询，社会保障卡号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "error");//输出参数
			log.sysLogMap(obj, request);
		} else {
			obj.put("domainid", "SBK");  //分系统号，见sys_log_bm
			obj.put("log_type", "T05");   //日志类别，见sys_log_bm
			obj.put("userid", aae011); //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "个人信息查询，社会保障卡号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "success");//输出参数
			log.sysLogMap(obj, request);
		}
		if(null == user)
		{
			Component.print(Util.Encode(user), response);
			return;
		}
		user.put("aaz001", aaz001);
		String str = ss.selectUnit2(user);
     	String[] res = str.split("&");
     	if(!res[0].equals("0")) { 
     		user.put("msg", res[0]);
     		Component.print(Util.Encode(user), response);
     	} else {
     		user.put("msg", res[0]);
     		Component.print(Util.Encode(user), response);
     	}     			
	}	
	/**
	 * 查询个人制卡登记信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getgrunitdata")
	public void getgrunitdata(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String aac001 = Component.getQuest("id", request);
		String aaz001 = Component.getQuest("aaz001", request);
		HashMap user = ss.getgrUnitData(aac001);		
		String aae011 = Component.getSession("userid", request);
		HashMap obj = new HashMap();	
		if(user == null) {
			obj.put("domainid", "SBK");   //分系统号，见sys_log_bm
			obj.put("log_type", "T05");   //日志类别，见sys_log_bm
			obj.put("userid", aae011);    //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "个人信息查询，社会保障卡号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "error");  //输出参数
			log.sysLogMap(obj, request);
		} else {
			obj.put("domainid", "SBK");   //分系统号，见sys_log_bm
			obj.put("log_type", "T05");   //日志类别，见sys_log_bm
			obj.put("userid", aae011);    //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "个人信息查询，社会保障卡号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "success");//输出参数
			log.sysLogMap(obj, request);
		}
		if(null == user)
		{
			Component.print(Util.Encode(user), response);
			return;
		}
		user.put("aac001", aac001);
		user.put("aaz001", aaz001);
		String str = ss.selectUnit1(user);
     	String[] res = str.split("&");
     	if(!res[0].equals("0")) { 
     		user.put("msg", res[0]);
     		Component.print(Util.Encode(user), response);
     	} else {
     		user.put("msg", res[0]);
     		Component.print(Util.Encode(user), response);
     	}     			
	}	
	/**
	 * 查询个人换卡登记信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getgrunitdata2")
	public void getgrunitdata2(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String aac001 = Component.getQuest("id", request);
		String aaz001 = Component.getQuest("aaz001", request);
		HashMap user = ss.getgrUnitData(aac001);		
		String aae011 = Component.getSession("userid", request);
		HashMap obj = new HashMap();	
		if(user == null) {
			obj.put("domainid", "SBK");   //分系统号，见sys_log_bm
			obj.put("log_type", "T05");   //日志类别，见sys_log_bm
			obj.put("userid", aae011);    //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "个人信息查询，社会保障卡号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "error");  //输出参数
			log.sysLogMap(obj, request);
		} else {
			obj.put("domainid", "SBK");   //分系统号，见sys_log_bm
			obj.put("log_type", "T05");   //日志类别，见sys_log_bm
			obj.put("userid", aae011);    //操作人
			obj.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			obj.put("content", "个人信息查询，社会保障卡号：" + Component.getQuest("id", request));
			obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			obj.put("datain", Component.getQuest("id", request)); //输入参数
			obj.put("dataout", "success");//输出参数
			log.sysLogMap(obj, request);
		}
		if(null == user)
		{
			Component.print(Util.Encode(user), response);
			return;
		}
		user.put("aac001", aac001);
		user.put("aaz001", aaz001);
		String str = ss.selectUnit2(user);
     	String[] res = str.split("&");
     	if(!res[0].equals("0")) { 
     		user.put("msg", res[0]);
     		Component.print(Util.Encode(user), response);
     	} else {
     		user.put("msg", res[0]);
     		Component.print(Util.Encode(user), response);
     	}     			
	}	
	/**
	 * 获取制卡批次
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getMakePc")
	public void getMakePc(HttpServletRequest request, HttpServletResponse response) throws Exception {	
		HashMap obj = new HashMap();		
		String aaz001 = ss.getMakeDWPc(obj);
		String aae011 = Component.getSession("userid", request);
		HashMap map = new HashMap();	
		if(aaz001 == null) {
			map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T05");   //日志类别，见sys_log_bm
			map.put("userid", aae011); //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "查询制卡批次：" + aaz001);
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", "单位批次：0"); //输入参数
			map.put("dataout", "error");  //输出参数
			log.sysLogMap(map, request);
		} else {
			map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T05");   //日志类别，见sys_log_bm
			map.put("userid", aae011); //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "查询制卡批次：" + aaz001);
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", "单位批次：0"); //输入参数
			map.put("dataout", "success");//输出参数
			log.sysLogMap(map, request);
		}
		Component.print(Util.Encode(aaz001), response);
	}	
	/**
	 * 获取制卡批次
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getgrMakePc")
	public void getgrMakePc(HttpServletRequest request, HttpServletResponse response) throws Exception {	
		HashMap obj = new HashMap();
		String aaz001 = ss.getMakeGRPc(obj);
		String aae011 = Component.getSession("userid", request);
		HashMap map = new HashMap();	
		if(aaz001 == null) {
			map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T05");   //日志类别，见sys_log_bm
			map.put("userid", aae011); //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "查询制卡批次：" + aaz001);
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", "个人批次：1"); //输入参数
			map.put("dataout", "error");//输出参数
			log.sysLogMap(map, request);
		} else {
			map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T05");   //日志类别，见sys_log_bm
			map.put("userid", aae011); //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "查询制卡批次：" + aaz001);
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", "个人批次：1"); //输入参数
			map.put("dataout", "success");//输出参数
			log.sysLogMap(map, request);
		}
		Component.print(Util.Encode(aaz001), response);
	}	
	/**
	 * 单位制卡登记信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=saveunit")
	public void saveUnit(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String idreturn = "";
		String json = request.getParameter("data");
		ArrayList rows = (ArrayList)Util.Decode(json);		
		HashMap row = (HashMap)rows.get(0);		
		String aae011 = Component.getSession("userid", request);
		Map m = new HashMap();
		HashMap map = new HashMap();
     	String sss = sys.callFunction("ZJ_GET_EVENTID", m);
     	String[] s = sss.split("&");
     	String aaz002 = s[0];
     	HashMap obj = new HashMap();
     	String aac001 = request.getParameter("id");
     	obj.put("aac001", aac001);     	
     	String str = ss.selectUnit1(obj);
     	String[] res = str.split("&");
     	if(!res[0].equals("0")) {
     		map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T02");   //日志类别，见sys_log_bm
			map.put("userid", aae011); //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "单位制卡登记操作：劳动保障证号" + row.get("aab001") + "社会保障卡号" + 
					row.get("aac001") + "制卡批次：" + row.get("aaz001"));
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", json); //输入参数
			map.put("dataout", "error");//输出参数
			log.sysLogMap(map, request);
     		Component.print(res[0], response);
     		return;
     	}
     	map.put("domainid", "SBK");   //分系统号，见sys_log_bm
		map.put("log_type", "T02");   //日志类别，见sys_log_bm
		map.put("userid", aae011);    //操作人
		map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
		map.put("content", "单位制卡登记操作：劳动保障证号" + row.get("aab001") + "社会保障卡号" + 
				row.get("aac001") + "制卡批次：" + row.get("aaz001"));
		map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
		map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
		map.put("datain", json);      //输入参数
		map.put("dataout", "success");//输出参数
		log.sysLogMap(map, request);
     	String chr2 = sys.SelResultStr("select chr(2) from dual");
     	String[] msg = res[1].split(chr2);     	
     	String aaz411 = msg[1];
     	row.put("aaz002", aaz002);
		row.put("aae011", aae011);		
		row.put("aaz411", aaz411);
		idreturn = ss.insertUnit(row);		
	    Component.print(idreturn, response);
	} 
	/**
	 * 单位换卡登记信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=saveunithk")
	public void saveunithk(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String idreturn = "";
		String json = request.getParameter("data");
		ArrayList rows = (ArrayList)Util.Decode(json);		
		HashMap row = (HashMap)rows.get(0);		
		String aae011 = Component.getSession("userid", request);
		Map m = new HashMap();
		HashMap map = new HashMap();
     	String sss = sys.callFunction("ZJ_GET_EVENTID", m);
     	String[] s = sss.split("&");
     	String aaz002 = s[0];
     	HashMap obj = new HashMap();
     	String aac001 = request.getParameter("id");
     	obj.put("aac001", aac001);     	
     	String str = ss.selectUnit2(obj);
     	String[] res = str.split("&");
     	if(!res[0].equals("0")) {
     		map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T02");   //日志类别，见sys_log_bm
			map.put("userid", aae011); //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "单位换卡登记操作：劳动保障证号" + row.get("aab001") + "社会保障卡号" + row.get("aac001") + "制卡批次：" + row.get("aaz001"));
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", json);      //输入参数
			map.put("dataout", "error");  //输出参数
			log.sysLogMap(map, request);
     		Component.print(res[0], response);
     		return;
     	}
     	map.put("domainid", "SBK");   //分系统号，见sys_log_bm
		map.put("log_type", "T02");   //日志类别，见sys_log_bm
		map.put("userid", aae011);    //操作人
		map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
		map.put("content", "单位换卡登记操作：劳动保障证号" + row.get("aab001") + "社会保障卡号" + row.get("aac001") + "制卡批次：" + row.get("aaz001"));
		map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
		map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
		map.put("datain", json);      //输入参数
		map.put("dataout", "success");//输出参数
		log.sysLogMap(map, request);
     	String chr2 = sys.SelResultStr("select chr(2) from dual");
     	String[] msg = res[1].split(chr2);     	
     	String aaz411 = msg[1];
     	row.put("aaz002", aaz002);
		row.put("aae011", aae011);		
		row.put("aaz411", aaz411);
		idreturn = ss.insertUnit(row);		
	    Component.print(idreturn, response);
	} 
	/**
	 * 制卡个人登记信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=savegrunit")
	public void savegrunit(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String idreturn = "";
		String json = request.getParameter("data");
		ArrayList rows = (ArrayList)Util.Decode(json);		
		HashMap row = (HashMap)rows.get(0);		
		String aae011 = Component.getSession("userid", request);
		Map m =new HashMap();
		HashMap map = new HashMap();
     	String sss = sys.callFunction("ZJ_GET_EVENTID", m);
     	String[] s = sss.split("&");
     	String aaz002 = s[0];
     	HashMap obj = new HashMap();
     	String aac001 = request.getParameter("id");
     	obj.put("aac001", aac001);   
     	String str = ss.selectUnit1(obj);
     	String[] res = str.split("&");
     	if(!res[0].equals("0")) {
     		map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T02");  //日志类别，见sys_log_bm
			map.put("userid", aae011);   //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "个人制卡登记操作：社会保障卡号" + row.get("aac001") + "制卡批次：" + row.get("aaz001"));
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", json);      //输入参数
			map.put("dataout", "error");  //输出参数
			log.sysLogMap(map, request);
     		Component.print(res[0], response);
     		return;
     	}
     	map.put("domainid", "SBK");  //分系统号，见sys_log_bm
		map.put("log_type", "T02");   //日志类别，见sys_log_bm
		map.put("userid", aae011); //操作人
		map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
		map.put("content", "个人制卡登记操作：社会保障卡号" + row.get("aac001") + "制卡批次：" + row.get("aaz001"));
		map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
		map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
		map.put("datain", json); //输入参数
		map.put("dataout", "success");//输出参数
		log.sysLogMap(map, request);
     	String chr2 = sys.SelResultStr("select chr(2) from dual");
     	String[] msg = res[1].split(chr2);     	
     	String aaz411 = msg[1];
     	row.put("aaz002", aaz002);
		row.put("aae011", aae011);		
		row.put("aaz411", aaz411);
		idreturn=ss.insertUnit(row);		
	    Component.print(idreturn, response);
	} 
	/**
	 * 换卡个人登记信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=savegrhkunit")
	public void savegrhkunit(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String idreturn = "";
		String json = request.getParameter("data");
		ArrayList rows = (ArrayList)Util.Decode(json);		
		HashMap row = (HashMap)rows.get(0);		
		String aae011 = Component.getSession("userid", request);
		Map m = new HashMap();
		HashMap map = new HashMap();
     	String sss = sys.callFunction("ZJ_GET_EVENTID", m);
     	String[] s = sss.split("&");
     	String aaz002 = s[0];
     	HashMap obj = new HashMap();
     	String aac001 = request.getParameter("id");
     	obj.put("aac001", aac001);
     	String str = ss.selectUnit2(obj);
     	String[] res = str.split("&");
     	if(!res[0].equals("0")) {
     		map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T02");   //日志类别，见sys_log_bm
			map.put("userid", aae011); //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "个人换卡登记操作：社会保障卡号" + row.get("aac001") + "制卡批次：" + row.get("aaz001"));
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", json);      //输入参数
			map.put("dataout", "error");  //输出参数
			log.sysLogMap(map, request);
     		Component.print(res[0], response);
     		return;
     	}
     	map.put("domainid", "SBK");   //分系统号，见sys_log_bm
		map.put("log_type", "T02");   //日志类别，见sys_log_bm
		map.put("userid", aae011);    //操作人
		map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
		map.put("content", "个人换卡登记操作：社会保障卡号" + row.get("aac001") + "制卡批次：" + row.get("aaz001"));
		map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
		map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
		map.put("datain", json);      //输入参数
		map.put("dataout", "success");//输出参数
		log.sysLogMap(map, request);
     	String chr2 = sys.SelResultStr("select chr(2) from dual");
     	String[] msg = res[1].split(chr2);     	
     	String aaz411 = msg[1];
     	row.put("aaz002", aaz002);
		row.put("aae011", aae011);	
		row.put("aaz411", aaz411);
		idreturn = ss.insertUnit(row);		
	    Component.print(idreturn, response);
	} 
	/**
	 * 单位制卡批量登记信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=saveunitpl")
	public void saveunitpl(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String idreturn = "";
		String json = request.getParameter("data");
		ArrayList rows = (ArrayList)Util.Decode(json);		
		HashMap row = (HashMap)rows.get(0);		
		String key = row.get("eventid").toString();
		String eventid = "";
		if(key.contains(">")) {
			String[]  str = key.split(">");
			eventid = str[1].substring(0,str[1].lastIndexOf("<"));
			row.put("eventid", eventid);
			} else {
				eventid = key;
			}
		String aae011 = Component.getSession("userid", request);	
		HashMap map = new HashMap();	
     	row.put("aaz002", eventid);
		row.put("aae011", aae011);		
		idreturn = ss.insertUnitpl(row);	
		if(!idreturn.equals("0")) {
			map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T02");  //日志类别，见sys_log_bm
			map.put("userid", aae011);   //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "单位批量制卡登记操作：劳动保障证号" + row.get("aab001") + "制卡批次：" + row.get("aaz001"));
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", json);      //输入参数
			map.put("dataout", "error");  //输出参数
			log.sysLogMap(map, request);
		} else {
			map.put("domainid", "SBK");   //分系统号，见sys_log_bm
			map.put("log_type", "T02");   //日志类别，见sys_log_bm
			map.put("userid", aae011);    //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "单位批量制卡登记操作：劳动保障证号" + row.get("aab001") + "制卡批次：" + row.get("aaz001"));
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", json);      //输入参数
			map.put("dataout", "success");//输出参数
			log.sysLogMap(map, request);
		}
	    Component.print(idreturn, response);
	} 
	/**
	 * 单位换卡批量登记信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=saveunithkpl")
	public void saveunithkpl(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String idreturn = "";
		String json = request.getParameter("data");
		ArrayList rows = (ArrayList)Util.Decode(json);		
		HashMap row = (HashMap)rows.get(0);	
		String key = row.get("eventid").toString();
		String eventid = "";
		if(key.contains(">")) {
			String[]  str = key.split(">");
			eventid = str[1].substring(0,str[1].lastIndexOf("<"));
			row.put("eventid", eventid);
			} else {
				eventid = key;
			}
		String aae011 = Component.getSession("userid", request);
		HashMap map = new HashMap();
     	row.put("aaz002", eventid);
		row.put("aae011", aae011);				
		idreturn = ss.insertUnitplhk(row);	
		if(!idreturn.equals("0")) {
			map.put("domainid", "SBK");   //分系统号，见sys_log_bm
			map.put("log_type", "T02");   //日志类别，见sys_log_bm
			map.put("userid", aae011);    //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "单位批量换 卡登记操作：劳动保障证号" + row.get("aab001") + "制卡批次：" + row.get("aaz001"));
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", json);      //输入参数
			map.put("dataout", "error");  //输出参数
			log.sysLogMap(map, request);
		} else {
			map.put("domainid", "SBK");   //分系统号，见sys_log_bm
			map.put("log_type", "T02");   //日志类别，见sys_log_bm
			map.put("userid", aae011);    //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "单位批量换卡登记操作：劳动保障证号" + row.get("aab001") + "制卡批次：" + row.get("aaz001"));
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", json);      //输入参数
			map.put("dataout", "success");//输出参数
			log.sysLogMap(map, request);
		}
	    Component.print(idreturn, response);
	} 
	/**
	 * 查询批量信息记录
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params = "method=getunit")
	public void getUnit(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String key = Component.getQuest("key", request);	
		String eventid = "";
		if(key.contains(">")) {
		String[]  str = key.split(">");
		eventid = str[1].substring(0,str[1].lastIndexOf("<"));
		} else {
			eventid = key;
		}
		String aae011 = Component.getSession("userid", request);
		HashMap parms = sys.getGridSort(request);
		HashMap map = new HashMap();
		String json = Util.Encode(ss.getUnit(new Object[] {eventid}, parms));
		if(null == json) {
			map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T02");   //日志类别，见sys_log_bm
			map.put("userid", aae011); //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "制卡信息批次查询：" + key);
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", key);       //输入参数
			map.put("dataout", "error");  //输出参数
			log.sysLogMap(map, request);
		} else {
			map.put("domainid", "SBK");   //分系统号，见sys_log_bm
			map.put("log_type", "T02");   //日志类别，见sys_log_bm
			map.put("userid", aae011);    //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "制卡信息批次查询：" + key);
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", key);       //输入参数
			map.put("dataout", "success");//输出参数
			log.sysLogMap(map, request);
		}
		Component.print(json, response);
	} 
	/**
	* 卡厂回盘数据数据导出
	* @author duy
	* @param request
	* @param response
	* @throws Exception
	*/
	@RequestMapping(params = "method=exkcdate")
	public void exkcdate(HttpServletRequest request, HttpServletResponse response) throws Exception {	
		String key = Component.getQuest("eventid", request);
		String eventid = "";
		if(key.contains(">")) {
		String[]  str = key.split(">");
		eventid = str[1].substring(0,str[1].lastIndexOf("<"));
		} else {
			eventid = key;
		}
	    File f = ss.exkcdate(eventid);
	    String userid = Component.getSession("userid", request);
	    HashMap obj = new HashMap();
		obj.put("domainid", "SBK");   //分系统号，见sys_log_bm
		obj.put("log_type", "T06");   //日志类别，见sys_log_bm
		obj.put("userid", userid);    //操作人
		obj.put("rwh", Component.getSession("rwid", request));	      //任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
		obj.put("content", "错误数据文件导出");  //日志内容，自己组合拼装
		obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
		obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
		obj.put("datain", "");        //输入参数
		obj.put("dataout", "success");//输出参数
		log.sysLogMap(obj, request);
	    Util.downLoadData(response, f, "zkgl_error" + eventid + ".xls");
	}
	/**
	* 卡厂回盘数据数据导出
	* @author duy
	* @param request
	* @param response
	* @throws Exception
	*/
	@RequestMapping(params = "method=checkdate")
	public void checkdate(HttpServletRequest request, HttpServletResponse response) throws Exception {	
		String key = Component.getQuest("eventid", request);
		System.out.println("key:"+key);
		String eventid = "";
		if(key.contains(">")) {
		String[]  str = key.split(">");
		eventid = str[1].substring(0,str[1].lastIndexOf("<"));		
		} else {
			eventid = key;
		}
	    String userid = Component.getSession("userid", request);
	    HashMap map = new HashMap();
	    map.put("eventid", eventid);
	    String str = ss.checkdate(map);
	    HashMap obj = new HashMap();
		obj.put("domainid", "SBK");   //分系统号，见sys_log_bm
		obj.put("log_type", "T06");   //日志类别，见sys_log_bm
		obj.put("userid", userid);    //操作人
		obj.put("rwh", Component.getSession("rwid", request));	      //任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
		obj.put("content", "错误数据文件导出");  //日志内容，自己组合拼装
		obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
		obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
		obj.put("datain", "");        //输入参数
		obj.put("dataout", "success");//输出参数
		log.sysLogMap(obj, request);
		Component.print(str, response);
	}
	/**
	* 卡厂回盘数据数据导出
	* @author duy
	* @param request
	* @param response
	* @throws Exception
	*/
	@RequestMapping(params = "method=checkdate2")
	public void checkdate2(HttpServletRequest request, HttpServletResponse response) throws Exception {	
		String key = Component.getQuest("eventid", request);
		System.out.println("key:"+key);
		String eventid = "";
		if(key.contains(">")) {
		String[]  str = key.split(">");
		eventid = str[1].substring(0,str[1].lastIndexOf("<"));		
		} else {
			eventid = key;
		}
	    String userid = Component.getSession("userid", request);
	    HashMap map = new HashMap();
	    map.put("eventid", eventid);
	    String str = ss.checkhkdate(map);
	    HashMap obj = new HashMap();
		obj.put("domainid", "SBK");   //分系统号，见sys_log_bm
		obj.put("log_type", "T06");   //日志类别，见sys_log_bm
		obj.put("userid", userid);    //操作人
		obj.put("rwh", Component.getSession("rwid", request));	      //任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
		obj.put("content", "错误数据文件导出");  //日志内容，自己组合拼装
		obj.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
		obj.put("czrlb", "L01");      //操作人类别，见sys_log_bm
		obj.put("datain", "");        //输入参数
		obj.put("dataout", "success");//输出参数
		log.sysLogMap(obj, request);
		Component.print(str, response);
	}
	/**
	 * 查询所有信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params ="method=getzkpcunit")
	public void getzkpcUnit(HttpServletRequest request, HttpServletResponse response) throws Exception{
		String key=Component.getQuest("key", request);	
		String aae011 = Component.getSession("userid", request);
		HashMap parms=sys.getGridSort(request);
		HashMap map = new HashMap();
		String json = Util.Encode(ss.getzkpc(new Object[] {key},parms));
		if(null==json)
		{
			map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T02");   //日志类别，见sys_log_bm
			map.put("userid", aae011); //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "制卡信息批次查询："+key);
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", key); //输入参数
			map.put("dataout", "error");//输出参数
			log.sysLogMap(map,request);
		}
		else
		{
			map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T02");   //日志类别，见sys_log_bm
			map.put("userid", aae011); //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "制卡信息批次查询："+key);
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", key); //输入参数
			map.put("dataout", "success");//输出参数
			log.sysLogMap(map,request);
		}
		Component.print(json, response);
	} 
	/**
	 * 查询所有信息
	 * @param request
	 * @param response
	 * @throws Exception
	 */
	@RequestMapping(params ="method=gethkpcunit")
	public void gethkpcunit(HttpServletRequest request, HttpServletResponse response) throws Exception{
		String key=Component.getQuest("key", request);	
		String aae011 = Component.getSession("userid", request);
		HashMap parms=sys.getGridSort(request);
		HashMap map = new HashMap();
		String json = Util.Encode(ss.gethkpc(new Object[] {key},parms));
		if(null==json)
		{
			map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T02");   //日志类别，见sys_log_bm
			map.put("userid", aae011); //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "制卡信息批次查询："+key);
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", key); //输入参数
			map.put("dataout", "error");//输出参数
			log.sysLogMap(map,request);
		}
		else
		{
			map.put("domainid", "SBK");  //分系统号，见sys_log_bm
			map.put("log_type", "T02");   //日志类别，见sys_log_bm
			map.put("userid", aae011); //操作人
			map.put("rwh", Component.getSession("rwid", request));	//任务号（菜单号），取Component.getSession("rwid", request),若特殊则为空为自定义
			map.put("content", "制卡信息批次查询："+key);
			map.put("czqd", "Q1");	      //操作渠道，见sys_log_bm
			map.put("czrlb", "L01");      //操作人类别，见sys_log_bm
			map.put("datain", key); //输入参数
			map.put("dataout", "success");//输出参数
			log.sysLogMap(map,request);
		}
		Component.print(json, response);
	} 
}